package com.sss.hloster02;
import java.util.Scanner;
public class Test2Array {

	public static void main(String[] args) {
		test01();
	}
private static void test01() {
	int i= 0;
	int j= 0;
	String[] course = {"Java基础","前端技术","后端技术"};
	String[] name = {"王云","刘景涛","南天华","雷静"};
	int[][] stuScore = new int[3][4];//存放所有学生各科成绩
	int[] singleSum = new int[] {0,0,0};//存放各科成绩的和
	int allScore =0;//存放总成绩
	Scanner input = new Scanner(System.in);
	//输入成绩，对单科成绩累加，对总成绩累加
	for(i=0;i<3;i++) {
		for(j=0;j<4;j++) {
			System.out.print("请输入科目："+course[i]+"学生："+name[j]+"的成绩：");
			stuScore[i][j]=input.nextInt();//读取学生成绩
			singleSum[i]=singleSum[i]	+stuScore[i][j]	;//单科成绩累加
			}
		allScore = allScore + singleSum[i];//总成绩累加
	}
	for(i=0;i<3;i++) {
		System.out.println("科目："+course[i]+"的平均成绩："+singleSum[i]/4.0);
	}
	System.out.println("总平均成绩："+allScore/12.0);
 }
}
